package com.bkhc.product.api;

import com.bkhc.common.annotation.ApiOperation;
import com.bkhc.common.annotation.ApiPackage;
import com.bkhc.common.annotation.AuditLog;
import com.bkhc.common.enu.OperationEnum;
import com.bkhc.common.util.response.ResultJson;
import com.bkhc.product.entity.BrandGoods;
import com.bkhc.product.entity.BrandProduct;
import com.bkhc.product.entity.PriceMode;
import com.bkhc.product.entity.ProductPrice;
import com.bkhc.product.service.PriceService;
import com.bkhc.product.vo.BrandGoodsVO;
import com.bkhc.product.vo.BusinessPriceAccountVo;
import com.bkhc.product.vo.ProductPriceVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/price")
@Api("品牌计价管理服务")
@ApiPackage(code="brand-api",name="品牌计价管理服务",description = "后台品牌计价管理维护操作接口")
public class PriceController {

    @Autowired
    private PriceService priceService;

    @ApiOperation(code="queryAllPriceByBrandProduct",name="查询品牌的产品商品价格",description = "查询品牌的产品商品价格")
    @AuditLog(object="queryAllPriceByBrandProduct",operation = "查询品牌的产品商品价格",type = OperationEnum.add)
    @RequestMapping(path = "/queryAllPriceByBrandProduct",method = RequestMethod.GET)
    public ResultJson<?> queryAllPriceByBrandProduct(@RequestParam(required = true)String productCode,@RequestParam(required = true)String brandCode) {
        ResultJson<?> res = priceService.queryAllPriceByBrandProduct(productCode,brandCode);
        return res;
    }

    @ApiOperation(code="queryPriceByBrandProductSpec",name="通过品牌产品的具体规格查询(商品)价格",description = "通过品牌产品的具体规格查询(商品)价格",type="common")
    @AuditLog(object="ProductPrice",operation = "通过品牌产品的具体规格查询(商品)价格",type = OperationEnum.query)
    @RequestMapping(path = "/queryPriceByBrandProductSpec",method = RequestMethod.POST)
    public ResultJson<?> queryPriceByBrandProductSpec(@RequestBody(required=true) BrandGoodsVO brandGoodsVO) {
        ResultJson<?> res = priceService.queryPriceByBrandProductSpec(brandGoodsVO);
        return res;
    }
//
//    @ApiOperation(code="addProductPrice",name="添加产品价格",description = "添加产品价格")
//    @AuditLog(object="ProductPrice",operation = "添加产品价格",type = OperationEnum.add)
//    @RequestMapping(path = "/addProductPrice",method = RequestMethod.POST)
//    public ResultJson<?> addProductPrice(@RequestBody(required=true) List<ProductPrice> list) {
//        ResultJson<?> res = priceService.addProductPrice(list);
//        return res;
//    }
//
    @ApiOperation(code="queryProductPrice",name="根据产品编号查询产品价格",description = "查询产品价格")
    @AuditLog(object="ProductPrice",operation = "查询产品价格",type = OperationEnum.query)
    @RequestMapping(path = "/queryProductPrice",method = RequestMethod.POST)
    public ResultJson<?> queryProductPrice(Map<String,String> paramMap, @RequestParam(name="pageNum") int pageIndex, @RequestParam(name="pageSize") int pageSize) {
        ResultJson<?> res = priceService.queryProductPrice(paramMap,pageIndex,pageSize);
        return res;
    }

    @ApiOperation(code="queryPriceByAccount",name="查询业务员可查看价格",description = "查询产品价格")
    @AuditLog(object="ProductPrice",operation = "查询产品价格",type = OperationEnum.query)
    @RequestMapping(path = "/queryProductPriceByPriceAccount",method = RequestMethod.POST)
    public ResultJson<?> queryProductPriceByPriceAccount(List<BusinessPriceAccountVo> accountVoList) {
        ResultJson<?> res = priceService.queryProductPriceByPriceAccount(accountVoList);
        return res;
    }
}
